package jpa;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.ResourceHttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

/**
 * Created by barton on 16-4-29.
 */
@SpringBootApplication
//@EnableAsync
@Controller
public class JpaApplication extends WebMvcConfigurerAdapter {

    public static void main(String[] args) {
        SpringApplication.run(JpaApplication.class, args);
    }

    @RequestMapping("/")
    public String index() {
        return "index";
    }

    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.add(new ByteArrayHttpMessageConverter());
        converters.add(new StringHttpMessageConverter());
        converters.add(new ResourceHttpMessageConverter());
        converters.add(new SourceHttpMessageConverter<>());
        converters.add(new AllEncompassingFormHttpMessageConverter());
        converters.add(new Jaxb2RootElementHttpMessageConverter());
//        converters.add(new SanJiMappingJackson2HttpMessageConverter());
    }
    //
//    @Bean
//    public SanJiMappingJackson2HttpMessageConverter converter() {
//        return new SanJiMappingJackson2HttpMessageConverter();
//    }
}
